package com.api.shopapi.mapper;


import com.api.shopapi.entity.RoleMenuRel;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface RoleMenuRelMapper {

    @Insert("insert into role_menu_rel values(#{roleMenuRel.RoleMenuRelCode},#{roleMenuRel.RoleCode}," +
            "#{roleMenuRel.MenuCode})")
    public int insert(@Param("roleMenuRel") RoleMenuRel roleMenuRel);


    @Delete("delete from role_menu_rel where roleMenuRelCode=#{roleMenuRelCode}")
    public int deleteByRoleMenuRelCode(@Param("roleMenuRelCode") String roleMenuRelCode);


    @Update("update role_menu_rel set RoleCode=#{roleMenuRel.RoleCode},MenuCode=#{roleMenuRel.MenuCode}," +
            "where RoleMenuRelCode=#{roleMenuRel.RoleMenuRelCode}")
    public int updateByRoleMenuRelCode(@Param("roleMenuRel") RoleMenuRel roleMenuRel);


    @Select("select * from role_menu_rel where roleMenuRelCode=#{roleMenuRelCode} limit 1")
    public RoleMenuRel getByRoleMenuRelCode(@Param("roleMenuRelCode") String roleMenuRelCode);


    @Select("select * from role_menu_rel")
    public List<RoleMenuRel> getList();

    @Select("select * from role_menu_rel where roleCode=#{roleCode}")
    public List<RoleMenuRel> getListByRoleCode(@Param("roleCode") String roleCode);


}
